package dao.Impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

import dao.BaseDao;
import dao.LibrarydbDao;
import entity.Librarydb;

public class LibrarydbDaoImpl<PreparedLibrarydb> extends BaseDao implements LibrarydbDao{

	@Override
	public Librarydb queryStudentById(int id) throws Exception {
		Connection conn = getConnection();
		String sql="SELECT * FROM user";
		PreparedStatement pstmt = conn.prepareStatement(sql);
		pstmt.setInt(1, id);
		@SuppressWarnings("unused")
		ResultSet result = pstmt.executeQuery();
		 
		Librarydb librarydb= null;
		if (result.next()) {
			librarydb = new Librarydb(
					result.getInt("id"),
					result.getString("name"),
					result.getInt("price"),
					result.getString("author"),
					result.getString("time")
					);
		}
		return librarydb;
		
	}

	public LibrarydbDaoImpl() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public List<Librarydb> queryStudents() throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Librarydb> queryStudentByName(String name) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int insertStudent(Librarydb librarydb) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updateStudent(Librarydb librarydb) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

}
